package com.dorukdestan.p2pshare.model;

import java.io.File;

import com.dorukdestan.p2pshare.util.Crc32Generator;

public class SharedFile extends File{
	
	private static final long serialVersionUID = -7032550028626072573L;

	private long hashValue;
	
	public SharedFile(String path) {
		super(path);
		hashValue = Crc32Generator.generateCrc(path);
	}
	
	public long getHashValue() {
		return hashValue;
	}
	
	/**
	 * This method should only be called in a DownloadingFile when the download process is finished
	 */
	public void updateHashValue(){
		hashValue = Crc32Generator.generateCrc(getAbsolutePath());
	}
	
	//TODO add these functions: update and updateIfNecessary(a state) 

}
